#include<bits/stdc++.h>
using namespace std;

int m, n;
char a[10][10];
int ans;
bool v_row[10], v_col[10];

void dfs(int k, int row)
{
	if(k == n)
	{
		ans++;
		return ;
	}
	if(row == m)
		return ;
	for(int i = row+1;i <= m;i++)
	{
		if(v_row[i])
			continue;
		for(int j = 1;j <= m;j++)
		{
			if(a[i][j] == '#' && !v_row[i] && !v_col[j])
			{
				v_row[i] = v_col[j] = 1;
				dfs(k+1, i);
				v_row[i] = v_col[j] = 0;
			}
		}
	}
	
}

int main()
{
	while(cin>>m>>n)
	{
		if(m == -1 && n == -1)
			break;
		memset(a, 0, sizeof a);
		memset(v_row, 0, sizeof v_row);
		memset(v_col, 0, sizeof v_col);
		ans = 0;
		for(int i = 1;i <= m;i++)
			for(int j = 1;j <= m;j++)
				cin>>a[i][j];
		dfs(0, 0);
		cout<<ans<<endl;
	}
	cout<<endl;
	system("pause"); 
	return 0;
}

